package love.yuanmengrobot.qianyugarden.service.impl;

import love.yuanmengrobot.qianyugarden.dao.ExperienceLogDao;
import love.yuanmengrobot.qianyugarden.entity.ExperienceLog;
import love.yuanmengrobot.qianyugarden.service.ExperienceLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (ExperienceLog)表服务实现类
 *
 * @author makejava
 * @since 2021-07-13 14:28:13
 */
@Service
public class ExperienceLogServiceImpl implements ExperienceLogService {
    @Autowired
    ExperienceLogDao experienceLogDao;

    /**
     * 通过ID查询单条数据
     *
     * @param objectid 主键
     * @return 实例对象
     */
    @Override
    public ExperienceLog queryById(String objectid) {
        return this.experienceLogDao.queryById(objectid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<ExperienceLog> queryAllByLimit(int offset, int limit) {
        return this.experienceLogDao.queryAllByLimit(offset, limit);
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param experienceLog 实例对象
     * @return 对象列表
     */
    @Override
    public List<ExperienceLog> queryAll(ExperienceLog experienceLog){
        return experienceLogDao.queryAll(experienceLog);
    }

    /**
     * 新增数据
     *
     * @param experienceLog 实例对象
     * @return 实例对象
     */
    @Override
    public ExperienceLog insert(ExperienceLog experienceLog) {
        this.experienceLogDao.insert(experienceLog);
        return experienceLog;
    }

    /**
     * 修改数据
     *
     * @param experienceLog 实例对象
     * @return 实例对象
     */
    @Override
    public ExperienceLog update(ExperienceLog experienceLog) {
        this.experienceLogDao.update(experienceLog);
        return this.queryById(experienceLog.getObjectid());
    }

    /**
     * 通过主键删除数据
     *
     * @param objectid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String objectid) {
        return this.experienceLogDao.deleteById(objectid) > 0;
    }
}
